package com.qingxin.sys.support;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * 基础线程类，继承该类并注册到线程管理器实现统一管理，在系统停止时进行统一销毁操作<br>
 * BaseThread baseThread = new MyBaseThread(); //创建线程后不可调用start方法，由管理器调用<br>
 * BaseThreadManager.add(baseThread); //添加到管理器<br>
 * @author Administrator
 *
 */
public class BaseThread extends Thread {
	protected Logger logger = LoggerFactory.getLogger(this.getClass());
	
	//运行状态
	protected volatile boolean running;
	
	/**
	 * 终止线程
	 */
	public void dispose(){
		running = false;
		try {
			this.interrupt();
		} catch (Exception e) {}
	}
	
	/**
	 * 获取线程状态
	 * 
	 * @return
	 */
	public boolean isRunning(){
		return running;
	}
}
